package site.wetsion.employ.server.mapper;

import java.math.BigInteger;
import java.util.List;
import org.apache.ibatis.annotations.Param;

import site.wetsion.employ.server.pojo.Condition;
import site.wetsion.employ.server.pojo.Job;
import site.wetsion.employ.server.pojo.JobRequestDetail;
import site.wetsion.employ.server.pojo.Location;

public interface JobMapper {

	/** 插入到tb_job*/
	public void insertJob(Job job) throws Exception;
	
	/** 插入到tb_job_requestdetail*/
	public void insertJobDetail(JobRequestDetail detail) throws Exception;
	/** 根据id删除职位*/
	public void deleteJobById(BigInteger id) throws Exception;
	/** 更新职位*/
	public void updateJob(Job job) throws Exception;
	/** 更新职位详情*/
	public void updateJobDetail(JobRequestDetail detail) throws Exception;
	/** 获取招聘职位总数量*/
	public int getJobCount() throws Exception;
	/** 根据id获取职位*/
	public Job getJobById(BigInteger id) throws Exception;
	/** 分页查找招聘职位*/
	public List<Job> getJobsByPage(int page, int pageSize) throws Exception;
	/** 获取查询的职位名称关键字的记录数量*/
	public int getSearchCountByName(String name) throws Exception;
	/** 按照职位名称搜索，并分页*/
	public List<Job> getJobOnSearchNameByPage(@Param("page") int page, 
			@Param("pageSize") int pageSize, @Param("name") String name) throws Exception;
	/** 根据职位详情id获取详情*/
	public JobRequestDetail getJobDetailById(BigInteger id) throws Exception;
	/** 多条件查询职位*/
	public List<Job> getJobOnConditionByPage(
			@Param("page") int page, 
			@Param("pageSize") int pageSize, 
			@Param("keyword") String keyword,
			@Param("location") BigInteger location,
			@Param("domain") Integer domain,
			@Param("jobCategory") Integer jobCategory,
			@Param("eduBackground") Integer eduBackground,
			@Param("worktime") Integer worktime) throws Exception;
	/** 多条件查询的总记录数*/
	public int getSearchCountByCondition(
			@Param("keyword") String keyword,
			@Param("location") BigInteger location,
			@Param("domain") Integer domain,
			@Param("jobCategory") Integer jobCategory,
			@Param("eduBackground") Integer eduBackground,
			@Param("worktime") Integer worktime) throws Exception;
	
	/** 分页获取公司下职位*/
	public List<Job> getJobsOfCompanyByPage(
			@Param("page") int page, 
			@Param("pageSize") int pageSize, 
			@Param("companyId") BigInteger companyId) throws Exception;
	
	/** 获取公司下职位数量*/
	public int getCountOfJobsOfCompanyByPage(BigInteger companyId) throws Exception;

	/** 根据发布人id获取该发布人的所有有效的发布职位*/
	public List<Job> getValidJobListByCreaterId(
			@Param("page") int page, 
			@Param("pageSize") int pageSize, 
			@Param("userId") BigInteger userId) throws Exception;
	/** 根据发布人id获取该发布人的所有有效的发布职位数量*/
	public int getCountOfValidJobByCreaterId(BigInteger userId) throws Exception;

	
	/** 根据发布人id获取该发布人的所有无效的发布职位*/
	public List<Job> getNulityJobListByCreaterId(
			@Param("page") int page, 
			@Param("pageSize") int pageSize, 
			@Param("userId") BigInteger userId) throws Exception;
	/** 根据发布人id获取该发布人的所有无效的发布职位数量*/
	public int getCountOfNulityJobByCreaterId(BigInteger userId) throws Exception;

	/** 根据关键字模糊查询城市*/
	public List<Location> getLocationsByKeyword(String keyword) throws Exception;
	
}
